class CreateOrders < ActiveRecord::Migration
  def self.up
    create_table :orders do |t|
      t.integer :enterprise_id
      t.string :order_no
      t.date :ordered_on
      t.string :buyer_full_name,
               :buyer_phone,
               :buyer_address
      t.date :deliveried_on
      t.string :shop_name
      t.string :saler_full_name
      t.decimal :sale_price, :precision => 8, :scale => 2, :default => 0
      t.decimal :order_price, :precision => 8, :scale => 2, :default => 0
      t.decimal :after_serviced_cost, :precision => 8, :scale => 2, :default => 0
      t.string :status, :default => 'being_edited'
      t.text :remark
      t.integer :created_by_user_id,
        :updated_by_user_id,
        :being_edited_by_user_id,
        :effected_by_user_id,
        :blanked_out_by_user_id,
        :filed_by_user_id
      t.timestamps
    end
  end

  def self.down
    drop_table :orders
  end
end
